package com.ziyucoding.springboot.labs.lab6.springdatajest.repository;

import com.ziyucoding.springboot.labs.lab6.springdatajest.dataobject.ESProductDO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

/**
 * 商品 Repository
 *
 * @author ziyucoding
 * @date 2022-10-30
 **/
public interface ProductRepository2 extends ElasticsearchRepository<ESProductDO, Integer> {

    /**
     * 根据名称查询商品
     *
     * @param name
     * @return ESProductDO
     **/
    ESProductDO findByName(String name);

    /**
     * 根据名称模糊分页查询
     *
     * @param name
     * @param pageable
     * @return Page<ESProductDO>
     **/
    Page<ESProductDO> findByNameLike(String name, Pageable pageable);

}
